import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class ToastContainer extends StatelessWidget {
  final String text;

  const ToastContainer({super.key, required this.text});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(25.0),
        color: Colors.white,
        boxShadow: const [
          BoxShadow(
            color: Colors.black26,
            blurRadius: 10.0,
            offset: Offset(0, 4),
          ),
        ],
      ),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: [
          const Icon(Icons.error, color: Colors.black),
          const SizedBox(width: 12.0),
          Text(text, style: TextStyle(color: Colors.black)),
        ],
      ),
    );
  }
}

void showToast(FToast toast, String text) {
  toast.showToast(
    child: ToastContainer(text: text),
    gravity: ToastGravity.TOP,
    toastDuration: const Duration(seconds: 2),
  );
}
